﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameBase.Form.Control;
using Microsoft.Xna.Framework;
using GameBase;

namespace GalaxyPresident
{
    public class PlanetItemControl : MyPanel
    {
        Planet planet;

        public Planet Planet
        {
            get { return planet; }
            set { planet = value; }
        }
        PlayingScreen playScreen;
        public PlanetItemControl(PlayingScreen screen, Planet planet)
        {
            this.planet = planet;
            this.playScreen = screen;
            sprite = new GameBase.Sprite(@"Resources/Ingame/ItemPanel", 1, 1);
            Color = planet.AtmospherColor;
            MyLabel name = new MyLabel(new Vector2(50, 5), planet.Name, 20);
            //name.Font = Constant.
            Add(name);
            MyLabel solarname = new MyLabel(new Vector2(50, 25),
                "Solar System: "+planet.SolarSystem.Name, 20);
            solarname.Font = Constant.fontSmall;
            Add(solarname);

            MyPanel backIcon = new MyPanel(@"Resources/InGame/Iconback",new Vector2(10,10));
            backIcon.Color = planet.BackColor;
            backIcon.Scale = 0.5f;

            MyPanel foreIcon = new MyPanel(@"Resources/InGame/Iconfore", Vector2.Zero);
            foreIcon.Color = planet.LandColor;
            backIcon.Add(foreIcon);

            Add(backIcon);
            MouseReleasedCallBack = Move;
        }

        protected void Move(MyControl obj)
        {
            playScreen.ShowPlanetLayer(((PlanetItemControl)obj).Planet);

        }
    }
}
